<?php
namespace App\Http\Controllers\ShopApi\V1\OrderManager;

use App\Http\Controllers\ShopApiController;
use App\Http\Controllers\Business\Shop\V1\OrderManagement\OrderManagement;

class OrderManagerController extends ShopApiController
{
    //订单列表
    public function orderList() {
        $shopId = $this->request->get('shopid');
        $startTime = $this->request->get('starttime');
        $lastTime = $this->request->get('lasttime');
        $result = OrderManagement::orderList($shopId, $startTime, $lastTime);
        if($result['status'] == 'failed') {
            return $this->responseError($result['message']);
        }
        $data = $result['data'];
        return $this->responseSuccessData($data);
    }
    //订单详情
    public function orderDetail() {
        $shopId = $this->request->get('shopid');
        $orderNumber = $this->request->get('ordernumber');
        $result = OrderManagement::orderDetails($shopId, $orderNumber);
        if($result['status'] == 'failed') {
            return $this->responseError($result['message']);
        }
        $data = $result['data'];
        if(!empty($data)) {
            $data['paytype'] = '余额支付';
        }
        return $this->responseSuccessData($data);
    }
}